﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace Prolog
{
    public partial class Form1 : Form
    {
        ConnectProlog con;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            FileStream fs = new FileStream(Application.StartupPath + @"\temp.txt", FileMode.Create);
            StreamWriter writer = new StreamWriter(fs, Encoding.UTF8);
            writer.Write(ProgramCodetxt.Text);
            writer.Flush();
            writer.Close();
            fs.Close();

            con.InputFile(Application.StartupPath + @"\temp.txt");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            //con = new ConnectProlog();
            Resulttxt.Text = con.Result(Querytxt.Text);
        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            con = new ConnectProlog();
        }
    }
}
